<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Mark a message for deletion from current mailbox</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.imap-delete" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">imap_delete</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">imap_delete</span> &mdash; <span class="dc-title">Mark a message for deletion from current mailbox</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.imap-delete-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>imap_delete</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$imap_stream</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$msg_number</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$options</code><span class="initializer"> = 0</span></span>
  ] ) : <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   Marks messages listed in <code class="parameter">msg_number</code> for deletion.
   Messages marked for deletion will stay in the mailbox until either
   <span class="function"><a href="imap_expunge.html" class="function">imap_expunge()</a></span> is called or
   <span class="function"><a href="imap_close.html" class="function">imap_close()</a></span> is called with the optional parameter
   <strong><code>CL_EXPUNGE</code></strong>.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.imap-delete-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    <dt>
<code class="parameter">
imap_stream</code></dt>
<dd>
<p class="para">由 <span class="function"><a href="imap_open.html" class="function">imap_open()</a></span> 返回的 IMAP 流。</p></dd>

    
     <dt>
<code class="parameter">msg_number</code></dt>

     <dd>

      <p class="para">
       The message number
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">options</code></dt>

     <dd>

      <p class="para">
       You can set the <strong><code>FT_UID</code></strong> which tells the function
       to treat the <code class="parameter">msg_number</code> argument as an
       <em>UID</em>.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.imap-delete-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns <strong><code>TRUE</code></strong>.
  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-function.imap-delete-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-4018">
    <p><strong>Example #1 <span class="function"><strong>imap_delete()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$mbox&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imap_open</span><span style="color: #007700">(</span><span style="color: #DD0000">"{imap.example.org}INBOX"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"username"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"password"</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;or&nbsp;die(</span><span style="color: #DD0000">"Can't&nbsp;connect:&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">imap_last_error</span><span style="color: #007700">());<br /><br /></span><span style="color: #0000BB">$check&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imap_mailboxmsginfo</span><span style="color: #007700">(</span><span style="color: #0000BB">$mbox</span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #DD0000">"Messages&nbsp;before&nbsp;delete:&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$check</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">Nmsgs&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"&lt;br&nbsp;/&gt;\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">imap_delete</span><span style="color: #007700">(</span><span style="color: #0000BB">$mbox</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$check&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imap_mailboxmsginfo</span><span style="color: #007700">(</span><span style="color: #0000BB">$mbox</span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #DD0000">"Messages&nbsp;after&nbsp;&nbsp;delete:&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$check</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">Nmsgs&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"&lt;br&nbsp;/&gt;\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">imap_expunge</span><span style="color: #007700">(</span><span style="color: #0000BB">$mbox</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$check&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imap_mailboxmsginfo</span><span style="color: #007700">(</span><span style="color: #0000BB">$mbox</span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #DD0000">"Messages&nbsp;after&nbsp;expunge:&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$check</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">Nmsgs&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"&lt;br&nbsp;/&gt;\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">imap_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$mbox</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

   </div>
  </p>
 </div>

 <div class="refsect1 notes" id="refsect1-function.imap-delete-notes">
  <h3 class="title">注释</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    IMAP mailboxes may not have their message flags saved between connections,
    so <span class="function"><a href="imap_expunge.html" class="function">imap_expunge()</a></span> should be called during the same
    connection in order to guarantee that messages marked for deletion will
    actually be purged.
   </p>
  </p></blockquote>
 </div>

 <div class="refsect1 seealso" id="refsect1-function.imap-delete-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="imap_undelete.html" class="function" rel="rdfs-seeAlso">imap_undelete()</a> - Unmark the message which is marked deleted</span></li>
    <li class="member"><span class="function"><a href="imap_expunge.html" class="function" rel="rdfs-seeAlso">imap_expunge()</a> - Delete all messages marked for deletion</span></li>
    <li class="member"><span class="function"><a href="imap_close.html" class="function" rel="rdfs-seeAlso">imap_close()</a> - Close an IMAP stream</span></li>
   </ul>
  </p>
 </div>

</div></div></div></body></html>